package com.example.service.impl;

import com.example.controller.Employee;
import com.example.dao.EmpDao;
import com.example.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class EmpServiceImpl implements EmpService {

    @Autowired
    private EmpDao empDao;


    @Override
    public List<Employee> empList() {
        List<Employee> employeeList = empDao.emplist();
        //处理 员工列表
        for (Employee employee : employeeList) {
            String gender = employee.getGender();
            if ("1".equals(gender)) {
                employee.setGender("男");
            } else if ("2".equals(gender)) {
                employee.setGender("女");
            }
            //1: 讲师, 2: 班主任 , 3: 就业指导
            String job = employee.getJob();
            if ("1".equals(job)) {
                employee.setJob("讲师");
            } else if ("2".equals(job)) {
                employee.setJob("班主任");
            } else if ("3".equals(job)) {
                employee.setJob("就业指导");
            }
        }
        return employeeList;
    }
}
